using System;
using System.Data;
using System.ComponentModel;
using System.Reflection;
using System.Collections.Generic;

namespace VSSAHT.Transfer
{
	[Serializable]
	public class ScaleTicketDTOBase : DTOBase
	{
		#region Property Active

		private bool _active;

		/// <summary>
		///  Property Active
		/// <summary>
		public bool Active
		{
			get
			{
				return _active;
			}

			set
			{
				if (_active != value)
				{
					this.OnActiveChanging(value);
					_active = value;
					this.OnActiveChanged();
					OnChanged();
				}
			}
		}

		#endregion

		#region Property ActualWeight

		private decimal _actualWeight;

		/// <summary>
		///  Property ActualWeight
		/// <summary>
		public decimal ActualWeight
		{
			get
			{
				return _actualWeight;
			}

			set
			{
				if (_actualWeight != value)
				{
					this.OnActualWeightChanging(value);
					_actualWeight = value;
					this.OnActualWeightChanged();
					OnChanged();
				}
			}
		}

		#endregion

		#region Property CustomerCode

		private string _customerCode;

		/// <summary>
		///  Property CustomerCode
		/// <summary>
		public string CustomerCode
		{
			get
			{
				return _customerCode;
			}

			set
			{
				if (_customerCode != value)
				{
					this.OnCustomerCodeChanging(value);
					_customerCode = value;
					this.OnCustomerCodeChanged();
					OnChanged();
				}
			}
		}

		#endregion

		#region Property CustomerName

		private string _customerName;

		/// <summary>
		///  Property CustomerName
		/// <summary>
		public string CustomerName
		{
			get
			{
				return _customerName;
			}

			set
			{
				if (_customerName != value)
				{
					this.OnCustomerNameChanging(value);
					_customerName = value;
					this.OnCustomerNameChanged();
					OnChanged();
				}
			}
		}

		#endregion

		#region Property Description

		private string _description;

		/// <summary>
		///  Property Description
		/// <summary>
		public string Description
		{
			get
			{
				return _description;
			}

			set
			{
				if (_description != value)
				{
					this.OnDescriptionChanging(value);
					_description = value;
					this.OnDescriptionChanged();
					OnChanged();
				}
			}
		}

		#endregion

		#region Property FirstWeight

		private decimal _firstWeight;

		/// <summary>
		///  Property FirstWeight
		/// <summary>
		public decimal FirstWeight
		{
			get
			{
				return _firstWeight;
			}

			set
			{
				if (_firstWeight != value)
				{
					this.OnFirstWeightChanging(value);
					_firstWeight = value;
					this.OnFirstWeightChanged();
					OnChanged();
				}
			}
		}

		#endregion

		#region Property InHour

		private DateTime _inHour;

		/// <summary>
		///  Property InHour
		/// <summary>
		public DateTime InHour
		{
			get
			{
				return _inHour;
			}

			set
			{
				if (_inHour != value)
				{
					this.OnInHourChanging(value);
					_inHour = value;
					this.OnInHourChanged();
					OnChanged();
				}
			}
		}

		#endregion

		#region Property ItemName

		private string _itemName;

		/// <summary>
		///  Property ItemName
		/// <summary>
		public string ItemName
		{
			get
			{
				return _itemName;
			}

			set
			{
				if (_itemName != value)
				{
					this.OnItemNameChanging(value);
					_itemName = value;
					this.OnItemNameChanged();
					OnChanged();
				}
			}
		}

		#endregion

		#region Property ItemNumber

		private string _itemNumber;

		/// <summary>
		///  Property ItemNumber
		/// <summary>
		public string ItemNumber
		{
			get
			{
				return _itemNumber;
			}

			set
			{
				if (_itemNumber != value)
				{
					this.OnItemNumberChanging(value);
					_itemNumber = value;
					this.OnItemNumberChanged();
					OnChanged();
				}
			}
		}

		#endregion

		#region Property ItemUnit

		private string _itemUnit;

		/// <summary>
		///  Property ItemUnit
		/// <summary>
		public string ItemUnit
		{
			get
			{
				return _itemUnit;
			}

			set
			{
				if (_itemUnit != value)
				{
					this.OnItemUnitChanging(value);
					_itemUnit = value;
					this.OnItemUnitChanged();
					OnChanged();
				}
			}
		}

		#endregion

		#region Property ItemUnit2

		private string _itemUnit2;

		/// <summary>
		///  Property ItemUnit2
		/// <summary>
		public string ItemUnit2
		{
			get
			{
				return _itemUnit2;
			}

			set
			{
				if (_itemUnit2 != value)
				{
					this.OnItemUnit2Changing(value);
					_itemUnit2 = value;
					this.OnItemUnit2Changed();
					OnChanged();
				}
			}
		}

		#endregion

		#region Property KgReduce

		private decimal _kgReduce;

		/// <summary>
		///  Property KgReduce
		/// <summary>
		public decimal KgReduce
		{
			get
			{
				return _kgReduce;
			}

			set
			{
				if (_kgReduce != value)
				{
					this.OnKgReduceChanging(value);
					_kgReduce = value;
					this.OnKgReduceChanged();
					OnChanged();
				}
			}
		}

		#endregion

		#region Property LocationCode

		private string _locationCode;

		/// <summary>
		///  Property LocationCode
		/// <summary>
		public string LocationCode
		{
			get
			{
				return _locationCode;
			}

			set
			{
				if (_locationCode != value)
				{
					this.OnLocationCodeChanging(value);
					_locationCode = value;
					this.OnLocationCodeChanged();
					OnChanged();
				}
			}
		}

		#endregion

		#region Property ModifiedBy

		private string _modifiedBy;

		/// <summary>
		///  Property ModifiedBy
		/// <summary>
		public string ModifiedBy
		{
			get
			{
				return _modifiedBy;
			}

			set
			{
				if (_modifiedBy != value)
				{
					this.OnModifiedByChanging(value);
					_modifiedBy = value;
					this.OnModifiedByChanged();
				}
			}
		}

		#endregion

		#region Property ModifiedDate

		private DateTime _modifiedDate;

		/// <summary>
		///  Property ModifiedDate
		/// <summary>
		public DateTime ModifiedDate
		{
			get
			{
				return _modifiedDate;
			}

			set
			{
				if (_modifiedDate != value)
				{
					this.OnModifiedDateChanging(value);
					_modifiedDate = value;
					this.OnModifiedDateChanged();
				}
			}
		}

		#endregion

		#region Property OutHour

		private DateTime? _outHour;

		/// <summary>
		///  Property OutHour
		/// <summary>
		public DateTime? OutHour
		{
			get
			{
				return _outHour;
			}

			set
			{
				if (_outHour != value)
				{
					this.OnOutHourChanging(value);
					_outHour = value;
					this.OnOutHourChanged();
					OnChanged();
				}
			}
		}

		#endregion

		#region Property PercentReduce

		private decimal _percentReduce;

		/// <summary>
		///  Property PercentReduce
		/// <summary>
		public decimal PercentReduce
		{
			get
			{
				return _percentReduce;
			}

			set
			{
				if (_percentReduce != value)
				{
					this.OnPercentReduceChanging(value);
					_percentReduce = value;
					this.OnPercentReduceChanged();
					OnChanged();
				}
			}
		}

		#endregion

		#region Property Quantity1

		private decimal _quantity1;

		/// <summary>
		///  Property Quantity1
		/// <summary>
		public decimal Quantity1
		{
			get
			{
				return _quantity1;
			}

			set
			{
				if (_quantity1 != value)
				{
					this.OnQuantity1Changing(value);
					_quantity1 = value;
					this.OnQuantity1Changed();
					OnChanged();
				}
			}
		}

		#endregion

		#region Property Quantity2

		private decimal? _quantity2;

		/// <summary>
		///  Property Quantity2
		/// <summary>
		public decimal? Quantity2
		{
			get
			{
				return _quantity2;
			}

			set
			{
				if (_quantity2 != value)
				{
					this.OnQuantity2Changing(value);
					_quantity2 = value;
                    
					this.OnQuantity2Changed();
					OnChanged();
				}
			}
		}

		#endregion

		#region Property RequireCode

		private string _requireCode;

		/// <summary>
		///  Property RequireCode
		/// <summary>
		public string RequireCode
		{
			get
			{
				return _requireCode;
			}

			set
			{
				if (_requireCode != value)
				{
					this.OnRequireCodeChanging(value);
					_requireCode = value;
					this.OnRequireCodeChanged();
					OnChanged();
				}
			}
		}

		#endregion

		#region Property RequireLimit

		private decimal _requireLimit;

		/// <summary>
		///  Property RequireLimit
		/// <summary>
		public decimal RequireLimit
		{
			get
			{
				return _requireLimit;
			}

			set
			{
				if (_requireLimit != value)
				{
					this.OnRequireLimitChanging(value);
					_requireLimit = value;
					this.OnRequireLimitChanged();
					OnChanged();
				}
			}
		}

		#endregion

		#region Property RequireName

		private string _requireName;

		/// <summary>
		///  Property RequireName
		/// <summary>
		public string RequireName
		{
			get
			{
				return _requireName;
			}

			set
			{
				if (_requireName != value)
				{
					this.OnRequireNameChanging(value);
					_requireName = value;
					this.OnRequireNameChanged();
					OnChanged();
				}
			}
		}

		#endregion

		#region Property RowVersion

		private string _rowVersion;

		/// <summary>
		///  Property RowVersion
		/// <summary>
		public string RowVersion
		{
			get
			{
				return _rowVersion;
			}

			set
			{
				if (_rowVersion != value)
				{
					this.OnRowVersionChanging(value);
					_rowVersion = value;
					this.OnRowVersionChanged();
					OnChanged();
				}
			}
		}

		#endregion

		#region Property ScaleTicketCode

		private string _scaleTicketCode;

		/// <summary>
		///  Property ScaleTicketCode
		/// <summary>
		public string ScaleTicketCode
		{
			get
			{
				return _scaleTicketCode;
			}

			set
			{
				if (_scaleTicketCode != value)
				{
					this.OnScaleTicketCodeChanging(value);
					_scaleTicketCode = value;
					this.OnScaleTicketCodeChanged();
					OnChanged();
				}
			}
		}

		#endregion

		#region Property ScaleTicketID

		private Guid _scaleTicketID;

		/// <summary>
		///  Property ScaleTicketID
		/// <summary>
		public Guid ScaleTicketID
		{
			get
			{
				return _scaleTicketID;
			}

			set
			{
				if (_scaleTicketID != value)
				{
					this.OnScaleTicketIDChanging(value);
					_scaleTicketID = value;
					this.OnScaleTicketIDChanged();
					OnChanged();
				}
			}
		}

		#endregion

		#region Property SecondWeight

		private decimal _secondWeight;

		/// <summary>
		///  Property SecondWeight
		/// <summary>
		public decimal SecondWeight
		{
			get
			{
				return _secondWeight;
			}

			set
			{
				if (_secondWeight != value)
				{
					this.OnSecondWeightChanging(value);
					_secondWeight = value;
					this.OnSecondWeightChanged();
					OnChanged();
				}
			}
		}

		#endregion

		#region Property VehicleID

		private string _vehicleID;

		/// <summary>
		///  Property VehicleID
		/// <summary>
		public string VehicleID
		{
			get
			{
				return _vehicleID;
			}

			set
			{
				if (_vehicleID != value)
				{
					this.OnVehicleIDChanging(value);
					_vehicleID = value;
					this.OnVehicleIDChanged();
					OnChanged();
				}
			}
		}

		#endregion

        #region Extension Rate weight

        public decimal Rate
        {
            get
            {
                return Math.Round((decimal)(_quantity2.Value > 0 ? _quantity1 / _quantity2.Value : 0), 2);
            }
        }
        #endregion

        #region Extension So cay
        

        public decimal SoCay
        {
            get
            {
                if ((ItemUnit != "KG" && ItemUnit != "TON") && (ItemUnit2 == "KG" || ItemUnit2 == "TON"))
                {
                    return Quantity1;
                }
                else if ((ItemUnit == "KG" || ItemUnit == "TON") && (ItemUnit2 != "KG" && ItemUnit2 != "TON"))
                {
                    return Quantity2.Value;
                }
                return 0;
            }
        }
        #endregion

        #region Extensibility Method Declarations

        protected virtual void OnActiveChanging(bool active) { }
		protected virtual void OnActiveChanged() { }
		protected virtual void OnActualWeightChanging(decimal actualWeight) { }
		protected virtual void OnActualWeightChanged() { }
		protected virtual void OnCustomerCodeChanging(string customerCode) { }
		protected virtual void OnCustomerCodeChanged() { }
		protected virtual void OnCustomerNameChanging(string customerName) { }
		protected virtual void OnCustomerNameChanged() { }
		protected virtual void OnDescriptionChanging(string description) { }
		protected virtual void OnDescriptionChanged() { }
		protected virtual void OnFirstWeightChanging(decimal firstWeight) { }
		protected virtual void OnFirstWeightChanged() { }
		protected virtual void OnInHourChanging(DateTime inHour) { }
		protected virtual void OnInHourChanged() { }
		protected virtual void OnItemNameChanging(string itemName) { }
		protected virtual void OnItemNameChanged() { }
		protected virtual void OnItemNumberChanging(string itemNumber) { }
		protected virtual void OnItemNumberChanged() { }
		protected virtual void OnItemUnitChanging(string itemUnit) { }
		protected virtual void OnItemUnitChanged() { }
		protected virtual void OnItemUnit2Changing(string itemUnit2) { }
		protected virtual void OnItemUnit2Changed() { }
		protected virtual void OnKgReduceChanging(decimal kgReduce) { }
		protected virtual void OnKgReduceChanged() { }
		protected virtual void OnLocationCodeChanging(string locationCode) { }
		protected virtual void OnLocationCodeChanged() { }
		protected virtual void OnModifiedByChanging(string modifiedBy) { }
		protected virtual void OnModifiedByChanged() { }
		protected virtual void OnModifiedDateChanging(DateTime modifiedDate) { }
		protected virtual void OnModifiedDateChanged() { }
		protected virtual void OnOutHourChanging(DateTime? outHour) { }
		protected virtual void OnOutHourChanged() { }
		protected virtual void OnPercentReduceChanging(decimal percentReduce) { }
		protected virtual void OnPercentReduceChanged() { }
		protected virtual void OnQuantity1Changing(decimal quantity1) { }
		protected virtual void OnQuantity1Changed() { }
		protected virtual void OnQuantity2Changing(decimal? quantity2) { }
		protected virtual void OnQuantity2Changed() { }
		protected virtual void OnRequireCodeChanging(string requireCode) { }
		protected virtual void OnRequireCodeChanged() { }
		protected virtual void OnRequireLimitChanging(decimal requireLimit) { }
		protected virtual void OnRequireLimitChanged() { }
		protected virtual void OnRequireNameChanging(string requireName) { }
		protected virtual void OnRequireNameChanged() { }
		protected virtual void OnRowVersionChanging(string rowVersion) { }
		protected virtual void OnRowVersionChanged() { }
		protected virtual void OnScaleTicketCodeChanging(string scaleTicketCode) { }
		protected virtual void OnScaleTicketCodeChanged() { }
		protected virtual void OnScaleTicketIDChanging(Guid scaleTicketID) { }
		protected virtual void OnScaleTicketIDChanged() { }
		protected virtual void OnSecondWeightChanging(decimal secondWeight) { }
		protected virtual void OnSecondWeightChanged() { }
		protected virtual void OnVehicleIDChanging(string vehicleID) { }
		protected virtual void OnVehicleIDChanged() { }

		#endregion

	}
}
